package com.jams.goodox.utils;

import android.app.Activity;
import android.content.DialogInterface;

import com.jams.goodox.BaseActivity;
import com.jams.goodox.R;
import com.jams.goodox.listen.DialogActionListener;
import com.jams.goodox.listen.SuccessListener;
import com.jams.goodox.widget.PromptBuilderDialog;

/**
 * Created by jams on 2016/9/27.
 * ***
 * Tel: ***
 */

public class ActionUtils {
    //show delete tips
    public static void deleteConfirm(Activity activity, String tip, final SuccessListener successListener){
        new PromptBuilderDialog(activity)
                .setTitle(R.string.tips)
                .setContent(tip)
                .setNegative(R.string.cancel)
                .setPositive(R.string.confirm)
                .setActionClickListener(new DialogActionListener() {
                    @Override
                    public void confirm(DialogInterface dialog, int which) {
                        dialog.dismiss();
                        successListener.success();
                    }

                    @Override
                    public void cancel(DialogInterface dialog, int which) {

                    }
                })
                .show();
    }

    //延时退出当前Activity
    public static void delayFinish(final BaseActivity activity){
        DelayUtils.doAfterDelay(1000, new DelayUtils.DelayDoListener() {
            @Override
            public void doAction() {
                activity.finish();
            }
        });
    }
}
